package com.junyidao.game.service;

import com.junyidao.game.mapper.SysPrivMapper;
import com.junyidao.game.pojo.SysPriv;
import com.junyidao.game.vo.SysPrivVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by zzh on 2016/8/18.
 */
@Service
@Transactional
public class SysPrivService {

    @Autowired
    private SysPrivMapper privMapper;

    public List<SysPriv> getSysPrivList(Integer uid) {
        Map<String, Object> map = new HashMap<>();
        map.put("uid", uid);
        List<SysPriv> list = privMapper.getSysPrivList(map);
        return list;
    }

    public List<SysPriv> getSysPrivAll() {
        List<SysPriv> list = privMapper.selectAll();
        return list;
    }


    public List<SysPriv> getSysPrivIdListByRole(Integer roleId) {
        Map<String, Object> map = new HashMap<>();
        map.put("roleId", roleId);
        List<SysPriv> list = privMapper.getSysPrivListByRoleId(map);
        return list;

    }

    public List<SysPrivVo> getUserRolePrivList(Integer uid) {
        Map<String, Object> map = new HashMap<>();
        map.put("uid", uid);
        List<SysPrivVo> privList = privMapper.getUserRolePrivList(map);
        return privList;
    }

    public List<SysPrivVo> getUserPrivList(Integer uid) {
        Map<String, Object> map = new HashMap<>();
        map.put("uid", uid);
        List<SysPrivVo> privList = privMapper.getUserPrivList(map);
        return privList;
    }
}
